import { defHttp } from "@/utils/http";

// ERP 药品账期管理 VO
export interface DrugAccPeriodMentVO {
	recordId: number; // 账期记录ID
	contractsNo: string; // 合同ID
	startDate: Date; // 账期开始时间
	endDate: Date; // 账期结束时间
	deptId: string; // 科室代码
}

// ERP 药品账期管理 API
export const DrugAccPeriodMentApi = {
	// 查询药品账期管理分页
	getDrugAccPeriodMentPage: async (params: any) => {
		return await defHttp.get({ url: `/whs/accounting-periods/page`, params });
	},

	// 查询药品账期管理详情
	getDrugAccPeriodMent: async (id: number) => {
		return await defHttp.get({ url: `/whs/accounting-periods/get?id=` + id });
	},

	// 新增药品账期管理
	createDrugAccPeriodMent: async (data: DrugAccPeriodMentVO) => {
		return await defHttp.post({ url: `/whs/accounting-periods/create`, data });
	},

	// 修改药品账期管理
	updateDrugAccPeriodMent: async (data: DrugAccPeriodMentVO) => {
		return await defHttp.put({ url: `/whs/accounting-periods/update`, data });
	},

	// 删除药品账期管理
	deleteDrugAccPeriodMent: async (id: number) => {
		return await defHttp.delete({
			url: `/whs/accounting-periods/delete?id=` + id
		});
	},

	// 导出药品账期管理 Excel
	exportDrugAccPeriodMent: async (params: any) => {
		return await defHttp.download({ url: `/whs/accounting-periods/export-excel`, params });
	}
};
